EasyAFEntityFrameworkApi<TContext>

Provides a base implementation of an Entity Framework API for EasyAF, integrating SimpleMessageBus event publishing and logging capabilities.

This class extends and is intended to be used as a base class for APIs that require access to the current HTTP context, logging, and SimpleMessageBus publishing.

Syntax

public abstract class EasyAFEntityFrameworkApi<TContext> : EntityFrameworkApi<TContext>, IDisposable, IEntityFrameworkApi where TContext : DbContext

Inheritance

  • object
    • ApiBase
      • EntityFrameworkApi&lt;TContext&gt;

Implements

Constructors

EasyAFEntityFrameworkApi

public EasyAFEntityFrameworkApi(IServiceProvider serviceProvider, IHttpContextAccessor httpContextAccessor, IMessagePublisher messagePublisher, ILogger<EasyAFEntityFrameworkApi<TContext>> logger)
Initializes a new instance of the class.

Parameters

Exceptions

  • [ArgumentNullException](https://learn.microsoft.com/dotnet/api/system.argumentnullexception): Thrown if httpContextAccessor or messagePublisher is null.

Properties

HttpContextAccessor

public IHttpContextAccessor HttpContextAccessor { get; set; }
Gets or sets the accessor for the current HTTP context. Used to access HTTP-specific information about the current request.

Returns

IHttpContextAccessor

Logger

public ILogger<EasyAFEntityFrameworkApi<TContext>> Logger { get; set; }
Gets or sets the instance used for writing log traces.

Returns

ILogger<EasyAFEntityFrameworkApi<TContext>>

MessagePublisher

public IMessagePublisher MessagePublisher { get; set; }
Gets or sets the used for publishing messages to SimpleMessageBus.

Returns

IMessagePublisher